/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package bygf.dts.utility;

/**
 *
 * @author Administrator
 */
public class GetFilePath  
{  
    //当前的工程下的路径  
    public static String getProjectPath()  
    {  
          
        return System.getProperty("user.dir")+"/";  
  
    }  
    //编译之后src下的文件路径，根据工程路径拼接  
    public static String getSrcPathAfterRun1()  
    {  
        return System.getProperty("user.dir")+"\\bin\\";  
    }  
    //根据反射获取编译之后包下面的文件路径  
    public static String getPackagePath()  
    {  
        String thisPackagePath=GetFilePath.class .getResource("").toString();  
//        System.out.println("路径："+thisPackagePath);  
        int m=thisPackagePath.indexOf("/");//去掉前面的file:  
        thisPackagePath=thisPackagePath.substring(m+1);  
//        System.out.println("路径："+thisPackagePath);  
        return thisPackagePath;//返回当前包返回的路径。  
    }  
    //根据反射获取编译之后的src下面的文件路径  
    public static String getSrcPathAfterRun2()  
    {  
        String path = GetFilePath.class.getClassLoader().getResource("").toString();  
        // System.out.println("编译后src路径："+path);//file:/D:/dev/workspase2Spring/XMLreader/bin/  
        int m = path.indexOf("/");// file:/<----点位到file:后面的反斜杠  
        path = path.substring(m + 1);// 从反斜杠之后的一位开始截取字符串  
        // System.out.println("编译后src路径："+path);  
        return path;  
    }  
}
